+2001-10-22 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
+ docs, #61777
+ (gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
+ change the two boolean args to a flags field, so we can extend
+ to add case insensitive, regexp searches later. #61852
+
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
+2001-10-22 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
+ docs, #61777
+ (gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
+ change the two boolean args to a flags field, so we can extend
+ to add case insensitive, regexp searches later. #61852
+
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
+2001-10-22 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
+ docs, #61777
+ (gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
+ change the two boolean args to a flags field, so we can extend
+ to add case insensitive, regexp searches later. #61852
+
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
+2001-10-22 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
+ docs, #61777
+ (gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
+ change the two boolean args to a flags field, so we can extend
+ to add case insensitive, regexp searches later. #61852
+
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
+2001-10-22 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
+ docs, #61777
+ (gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
+ change the two boolean args to a flags field, so we can extend
+ to add case insensitive, regexp searches later. #61852
+
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
+2001-10-22 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
+ docs, #61777
+ (gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
+ change the two boolean args to a flags field, so we can extend
+ to add case insensitive, regexp searches later. #61852
+
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
+2001-10-22 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
+ docs, #61777
+ (gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
+ change the two boolean args to a flags field, so we can extend
+ to add case insensitive, regexp searches later. #61852
+
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
Adds a new #GtkMenuItem to the end of the menu's item list.
</para>
+<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
-<!-- # Unused Parameters # -->
@m:
@c:
Adds a new #GtkMenuItem to the beginning of the menu's item list.
</para>
+<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
-<!-- # Unused Parameters # -->
@menu_child:
@m:
@c:
indicated by @position.
</para>
+<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
@pos:
-<!-- # Unused Parameters # -->
@position: The position in the item list where @child is added.
Positions are numbered from 0 to n-1.
@iter:
@str:
-@visible_only:
-@slice:
+@flags:
@match_start:
@match_end:
@limit:
@Returns:
+<!-- # Unused Parameters # -->
+@visible_only:
+@slice:
<!-- ##### FUNCTION gtk_text_iter_backward_search ##### -->
@iter:
@str:
-@visible_only:
-@slice:
+@flags:
@match_start:
@match_end:
@limit:
@Returns:
+<!-- # Unused Parameters # -->
+@visible_only:
+@slice:
<!-- ##### FUNCTION gtk_text_iter_equal ##### -->
* @iter: a #GtkTextIter
* @line_number: line number (counted from 0)
*
- * Moves iterator @iter to the start of the line @line_number.
+ * Moves iterator @iter to the start of the line @line_number. If
+ * @line_number is negative or larger than the number of lines in the
+ * buffer, moves @iter to the start of the last line in the buffer.
*
**/
void
* gtk_text_iter_forward_search:
* @iter: start of search
* @str: a search string
- * @visible_only: if %TRUE, search only visible text
- * @slice: if %TRUE, @str contains 0xFFFC when we want to match widgets, pixbufs
+ * @flags: flags affecting how the search is done
* @match_start: return location for start of match, or %NULL
* @match_end: return location for end of match, or %NULL
* @limit: bound for the search, or %NULL for the end of the buffer
*
- * Searches forward for @str. Any match is returned as the range @match_start,
- * @match_end. If you specify @visible_only or @slice, the match may have
- * invisible text, pixbufs, or child widgets interspersed in @str.
+ * Searches forward for @str. Any match is returned as the range
+ * @match_start, @match_end. The search will not continue past
+ * @limit. Note that a search is a linear or O(n) operation, so you
+ * may wish to use @limit to avoid locking up your UI on large
+ * buffers.
*
+ * If the #GTK_TEXT_SEARCH_VISIBLE_ONLY flag is present, the match may
+ * have invisible text interspersed in @str. i.e. @str will be a
+ * possibly-noncontiguous subsequence of the matched range. similarly,
+ * if you specify #GTK_TEXT_SEARCH_TEXT_ONLY, the match may have
+ * pixbufs or child widgets mixed inside the matched range. If these
+ * flags are not given, the match must be exact; the special 0xFFFC
+ * character in @str will match embedded pixbufs or child widgets.
+ *
* Return value: whether a match was found
**/
gboolean
gtk_text_iter_forward_search (const GtkTextIter *iter,
const gchar *str,
- gboolean visible_only,
- gboolean slice,
+ GtkTextSearchFlags flags,
GtkTextIter *match_start,
GtkTextIter *match_end,
const GtkTextIter *limit)
GtkTextIter match;
gboolean retval = FALSE;
GtkTextIter search;
-
+ gboolean visible_only;
+ gboolean slice;
+
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (str != NULL, FALSE);
return FALSE;
}
+ visible_only = (flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0;
+ slice = (flags & GTK_TEXT_SEARCH_TEXT_ONLY) == 0;
+
/* locate all lines */
lines = strbreakup (str, "\n", -1);
* gtk_text_iter_backward_search:
* @iter: a #GtkTextIter where the search begins
* @str: search string
- * @visible_only: if %TRUE search only visible text
- * @slice: if %TRUE the search string contains 0xFFFC to match pixbufs, widgets
+ * @flags: bitmask of flags affecting the search
* @match_start: return location for start of match, or %NULL
* @match_end: return location for end of match, or %NULL
* @limit: location of last possible @match_start, or %NULL for start of buffer
gboolean
gtk_text_iter_backward_search (const GtkTextIter *iter,
const gchar *str,
- gboolean visible_only,
- gboolean slice,
+ GtkTextSearchFlags flags,
GtkTextIter *match_start,
GtkTextIter *match_end,
const GtkTextIter *limit)
gint n_lines;
LinesWindow win;
gboolean retval = FALSE;
-
+ gboolean visible_only;
+ gboolean slice;
+
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (str != NULL, FALSE);
return FALSE;
}
+ visible_only = (flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0;
+ slice = (flags & GTK_TEXT_SEARCH_TEXT_ONLY) == 0;
+
/* locate all lines */
lines = strbreakup (str, "\n", -1);
extern "C" {
#endif /* __cplusplus */
+typedef enum {
+ GTK_TEXT_SEARCH_VISIBLE_ONLY,
+ GTK_TEXT_SEARCH_TEXT_ONLY
+ /* Possible future plans: SEARCH_CASE_INSENSITIVE, SEARCH_REGEXP */
+} GtkTextSearchFlags;
+
/*
* Iter: represents a location in the text. Becomes invalid if the
* characters/pixmaps/widgets (indexable objects) in the text buffer
gboolean gtk_text_iter_forward_search (const GtkTextIter *iter,
const gchar *str,
- gboolean visible_only,
- gboolean slice,
+ GtkTextSearchFlags flags,
GtkTextIter *match_start,
GtkTextIter *match_end,
const GtkTextIter *limit);
gboolean gtk_text_iter_backward_search (const GtkTextIter *iter,
const gchar *str,
- gboolean visible_only,
- gboolean slice,
+ GtkTextSearchFlags flags,
GtkTextIter *match_start,
GtkTextIter *match_end,
const GtkTextIter *limit);
if (forward)
{
- while (gtk_text_iter_forward_search (&iter, str, TRUE, FALSE,
+ while (gtk_text_iter_forward_search (&iter, str,
+ GTK_TEXT_SEARCH_VISIBLE_ONLY |
+ GTK_TEXT_SEARCH_TEXT_ONLY,
&match_start, &match_end,
NULL))
{
}
else
{
- while (gtk_text_iter_backward_search (&iter, str, TRUE, FALSE,
+ while (gtk_text_iter_backward_search (&iter, str,
+ GTK_TEXT_SEARCH_VISIBLE_ONLY |
+ GTK_TEXT_SEARCH_TEXT_ONLY,
&match_start, &match_end,
NULL))
{